<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/head.jsp"%>
<!DOCTYPE html>
<html>
<link href="${basepath}/css/viewcss/main/customerInfo/memberinfo.css" rel="stylesheet" type="text/css"/>
<head>
    <title>客户基本信息</title>
    <meta charset="utf-8">
    <style>
    	body {
			padding: 0;
			font-size: 12px;
		}
		label{
			font-size:14px;
			margin:4px;
		}
		.mtd{
			float:left;
			width:50%
		}
		.userinfo{
			margin-left:20px;
			text-align:left;
			margin-top:5px;
		}
    </style>
</head>
<script>
	$(document).ready(function() {
		//查询用户信息
		$.ajax({
            url: "${path}/assist/queryUserInfo?c_user_id=${c_user_id}",
            type:"POST", 
            contentType: "application/json",
            dataType: "json",
            success: function(doc) {
            	$('#memberName').html("家庭称谓:"+doc[0].member_name);
            	$('#realName').html("昵称:"+doc[0].real_name);
            	$('#birthday').html("生日:"+doc[0].birthday);
            	$('#phone').html("联系方式:"+doc[0].phone);
            	var addressStr = doc[0].address;
            	if(!addressStr){
            		addressStr = "";
            	}
            	
            	$('#address').html("地址:"+addressStr);
            	$('#userPhoto').attr('src',doc[0].image_src); 
            	queryFamilyInfo();
            }
        });
		
		//家庭信息
		var queryFamilyInfo = function(){
			$.ajax({
	            url: "${path}/assist/queryFamilyInfoByUserId?c_user_id=${c_user_id}",
	            type:"POST", 
	            contentType: "application/json",
	            dataType: "json",
	            success: function(doc) {
	            	$('#familyName').html("家庭名:"+doc[0].familyName);
	            	$.each(doc[0].familyMemberList,function(k,v){
	            		$('#custinfo').append("<tr><td><label>"+v.memberName+"</label></td>"+
	            			"<td><label>"+v.real_name+"</label></td>"+
	            			"<td><label>"+v.cRoleName+"</label></td>"+
	            			"<td><label>"+v.phone+"</label></td></tr>");
	            	});
	            	//queryMemberCard();
	            }
	        });
		}
		
		//会员卡信息
		var queryMemberCard = function(){
			$.ajax({
	            url: "${path}/assist/queryMemberCardInfo?c_user_id=${c_user_id}",
	            type:"POST", 
	            contentType: "application/json",
	            dataType: "json",
	            success: function(doc) {
	            	$.each(doc,function(k,v){
	            		$('#content').append("<h1 id='memberCard'>"+v.baby_name+"-会员卡号:"+v.card_number+"</h1>");
	            		$('#content').append("<table style='width:100%;padding:2px;text-align:center'>"+
		        				"<tr><td style='width:20%;text-align:center'>"+
		    					"	<label style='font-size:14px;font-weight:bold;'>监护人姓名</label>"+
		    					"</td>"+
		    	                "<td style='width:20%;text-align:center'>"+
		    					"	<label style='font-size:14px;font-weight:bold;'>联系方式</label>"+
		    	                "</td></tr></table>");
	            		$.each(v.memberCardGuardian,function(ck,cv){
	            			$('#content').append("<div class='mtd'>"+cv.name+"</div>"+
	                    			"<div>"+cv.phone+"</div>");
	            		});
	            	})
	            }
	        });
		}
		
	});
	
</script>
<body style="padding:0px">
	<form class="bootstrap-frm" action="" method="post">
		<div style="width:100%;padding-top:10px;padding-bottom:20px;text-align:center;" id="content">
			<div style="margin-right:20px;float:left" class="userinfo">
				<img id="userPhoto" style="height:70px;width:70px" src="" />
			</div>
			<div class="userinfo" id="memberName"></div>
			<div class="userinfo" id="realName"></div>
			<div class="userinfo" id="birthday"></div>
			<div class="userinfo" id="address"></div>
			<h1 id="familyName">家庭信息</h1>
			<table style="width:100%;padding:2px;text-align:center" id="custinfo">
				<tr>
					<td style="width:20%;text-align:center">
						<label style="font-size:14px;font-weight:bold;">称谓</label>
					</td>
					<td style="width:20%;text-align:center">
						<label style="font-size:14px;font-weight:bold;">昵称</label>
	                </td>
					<td style="width:20%;text-align:center">
						<label style="font-size:14px;font-weight:bold;">角色</label>
	                </td>
	                <td style="width:20%;text-align:center">
						<label style="font-size:14px;font-weight:bold;">联系方式</label>
	                </td>
				</tr>
			</table>
			<h1></h1>
		</div>
	</form>
</body>
</html>
